<template>
    <cfg-form-list slot="right">
        <cfg-title v-bind="config.title"></cfg-title>
        <cfg-form :only-read="onlyRead" v-bind="config.section.start" :data="data"></cfg-form>
        <cfg-subtitle :title="'投料:'"></cfg-subtitle>
        <cfg-form :onlyRead="onlyRead" style="border:1px solid #dcdee2;padding-top: 10px;" v-bind="config.section.feed" :data="data.feed"></cfg-form>
        <cfg-subtitle :title="'产物:'"></cfg-subtitle>
        <cfg-form :onlyRead="onlyRead" style="border:1px solid #dcdee2;padding-top: 10px;" v-bind="config.section.product" :data="data.product"></cfg-form>
        <cfg-subtitle :title="'记录:'"></cfg-subtitle>
        <cfg-sheet :onlyRead="onlyRead" v-bind="config.section.records" :data="data.records"></cfg-sheet>
        <Button type="primary" long @click="data.records.push({})">加一行</Button>
        <cfg-subtitle :title="'备注:'"></cfg-subtitle>
        <cfg-form :onlyRead="onlyRead" style="border:1px solid #dcdee2;padding-top: 10px;" v-bind="config.section.comments" :data="data.comments"></cfg-form>
        <cfg-form :only-read="onlyRead" style="margin-top:10px;" v-bind="config.section.end" :data="data"></cfg-form>
    </cfg-form-list>
</template>

<script>
    export default {
        data () {
            return {
                onlyRead: false,
                config: {
                    title: {
                        title: '碳化/破碎生产通知书',
                        titleStyle: {},
                        outlineStyle: { marginBottom: '20px' }
                    },
                    section: {
                        start: {
                            labelWidth: 70,
                            labelPosition: 'right',
                            cols: 3,
                            columns: [
                                { title: '表单号:', key: 'formNo', config: { type: 'text' } },
                                { title: '流水号:', key: 'No', config: { type: 'text' } }
                            ],
                            rules: {}
                        },
                        feed: {
                            labelWidth: 110,
                            labelPosition: 'right',
                            cols: 2,
                            columns: [
                                { title: 'W + C批号:', key: 'batchNo', config: { type: 'text' } },
                                { title: '投入量（kg):', key: 'amount', config: { type: 'text' } }
                            ],
                            rules: {}
                        },
                        product: {
                            labelWidth: 70,
                            labelPosition: 'right',
                            cols: 2,
                            columns: [
                                { title: '名称:', key: 'name', config: { type: 'text' } },
                                { title: '批号:', key: 'batchNo', config: { type: 'text' } }
                            ],
                            rules: {}
                        },
                        records: {
                            columns: [
                                { title: '温度 <br/>（摄氏）',
                                  align: 'center',
                                  key: 'temp',
                                  config: { type: 'number' }
                                },
                                { title: '推速<br/>(分/舟)', align: 'center', key: 'speed', config: { type: 'number' } },
                                { title: '装舟量<br/>(kg/舟)', align: 'center', key: 'weight', config: { type: 'number' } }
                            ]
                        },
                        comments: {
                            labelWidth: 100,
                            labelPosition: 'right',
                            cols: 4,
                            columns: [
                                { title: '清机:', key: 'clear', config: { type: 'select', options: [{ label: '是', value: 'mo' }, { label: '否', value: 'carbon' }] } },
                                { title: '生产设备:', key: 'productEquipment', config: { type: 'select', options: [{ label: '钼丝炉', value: 'mo' }, { label: '碳管炉', value: 'carbon' }] } },
                                {
                                    title: '破碎设备:',
                                    key: 'breakEquipment',
                                    config: {
                                        type: 'select',
                                        options: [
                                            { label: '1#', value: '1' },
                                            { label: '2#', value: '2' },
                                            { label: '3#', value: '3' },
                                            { label: '4#', value: '4' },
                                            { label: '5#', value: '5' },
                                            { label: '6#', value: '6' },
                                            { label: '7#', value: '7' },
                                            { label: '8#', value: '8' },
                                            { label: '9#', value: '9' },
                                            { label: '10#', value: '10' }
                                        ]
                                    }
                                },
                                { title: '破碎时间:', key: 'breakDate', config: { type: 'text' } },
                                { title: '过筛:',
                                  key: 'filter',
                                  config: {
                                      type: 'select',
                                      options: [
                                          { label: '20目', value: '20' },
                                          { label: '40目', value: '40' },
                                          { label: '60目', value: '60' },
                                          { label: '80目', value: '80' },
                                          { label: '100目', value: '100' },
                                          { label: '120目', value: '120' },
                                          { label: '140目', value: '140' },
                                          { label: '160目', value: '160' },
                                          { label: '200目', value: '200' }
                                      ]
                                  }
                                },
                                { title: '总碳CT:', key: 'ct', config: { type: 'text' } },
                                { title: '费氏FSSS:', key: 'fsss', config: { type: 'text' } }

                            ],
                            rules: {}
                        },
                        end: {
                            labelWidth: 70,
                            labelPosition: 'right',
                            columns: [
                                { title: '通知者:', key: 'notifier', config: { type: 'text' } },
                                { title: '审核:', key: 'auditor', config: { type: 'text' } },
                                { title: '日期:', key: 'date', config: { type: 'date' } }
                            ],
                            cols: 3,
                            rules: {}
                        }
                    }
                }
            };
        },
        props: {
            data: {
                default: () => {
                    return {
                        formNo: 'HM-AH032-A',
                        No: '碳第  2022-1052  号',
                        feed: {
                            batchNo: '',
                            amount: ''
                        },
                        product: {
                            name: '',
                            batchNo: ''
                        },
                        records: [
                            {
                                temp: 0,
                                speed: 0,
                                weight: 0
                            }
                        ],
                        comments: {
                            clear: '1',
                            productEquipment: '',
                            breakEquipment: '',
                            breakDate: '',
                            filter: '',
                            ct: '',
                            fsss: ''
                        },
                        notifier: '',
                        auditor: '',
                        date: ''
                    }
                }
            }
        }
    };
</script>
<style scoped lang="scss"></style>
